home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Developer Essentials / MPW Interfaces & Libraries / PInterfaces / Aliases.p < prev    next >
Encoding:
Text File  |  1992-01-29  |  4.7 KB  |  142 lines  |  [TEXT/MPS ]

  1.  
  2. {
  3. Created: Sunday, September 15, 1991 at 9:40 PM
  4.  Aliases.p
  5.  Pascal Interface to the Macintosh Libraries
  6.  
  7.   Copyright Apple Computer, Inc. 1989-1991
  8.   All rights reserved
  9. }
  10.  
  11.  
  12. {$IFC UNDEFINED UsingIncludes}
  13. {$SETC UsingIncludes := 0}
  14. {$ENDC}
  15.  
  16. {$IFC NOT UsingIncludes}
  17.  UNIT Aliases;
  18.  INTERFACE
  19. {$ENDC}
  20.  
  21. {$IFC UNDEFINED UsingAliases}
  22. {$SETC UsingAliases := 1}
  23.  
  24. {$I+}
  25. {$SETC AliasesIncludes := UsingIncludes}
  26. {$SETC UsingIncludes := 1}
  27. {$IFC UNDEFINED UsingTypes}
  28. {$I $$Shell(PInterfaces)Types.p}
  29. {$ENDC}
  30. {$IFC UNDEFINED UsingDialogs}
  31. {$I $$Shell(PInterfaces)Dialogs.p}
  32. {$ENDC}
  33. {$IFC UNDEFINED UsingAppleTalk}
  34. {$I $$Shell(PInterfaces)AppleTalk.p}
  35. {$ENDC}
  36. {$IFC UNDEFINED UsingFiles}
  37. {$I $$Shell(PInterfaces)Files.p}
  38. {$ENDC}
  39. {$SETC UsingIncludes := AliasesIncludes}
  40.  
  41. CONST
  42. rAliasType = 'alis';                { Aliases are stored as resources of this type }
  43.  
  44. { define alias resolution action rules mask }
  45. kARMMountVol = $00000001;            { mount the volume automatically }
  46. kARMNoUI = $00000002;                { no user interface allowed during resolution }
  47. kARMMultVols = $00000008;            { search on multiple volumes }
  48. kARMSearch = $00000100;                { search quickly }
  49. kARMSearchMore = $00000200;            { search further }
  50. kARMSearchRelFirst = $00000400;        { search target on a relative path first }
  51.  
  52. { define alias record information types }
  53. asiZoneName = -3;                    { get zone name }
  54. asiServerName = -2;                    { get server name }
  55. asiVolumeName = -1;                    { get volume name }
  56. asiAliasName = 0;                    { get aliased file/folder/volume name }
  57. asiParentName = 1;                    { get parent folder name }
  58.  
  59.  
  60. TYPE
  61. { define the alias record that will be the blackbox for the caller }
  62. AliasPtr = ^AliasRecord;
  63. AliasHandle = ^AliasPtr;
  64. AliasRecord = RECORD
  65.  userType: OSType;                    { appl stored type like creator type }
  66.  aliasSize: INTEGER;                { alias record size in bytes, for appl usage }
  67.  END;
  68.  
  69.  
  70. AliasInfoType = INTEGER;            { alias record information type }
  71. AliasFilterProcPtr = ProcPtr;
  72.  
  73.  
  74. {  create a new alias between fromFile-target and return alias record handle  }
  75. FUNCTION NewAlias(fromFile: FSSpecPtr;
  76.                   target: FSSpec;
  77.                   VAR alias: AliasHandle): OSErr;
  78.  INLINE $7002,$A823;
  79.  
  80. { create a minimal new alias for a target and return alias record handle }
  81. FUNCTION NewAliasMinimal(target: FSSpec;
  82.                          VAR alias: AliasHandle): OSErr;
  83.  INLINE $7008,$A823;
  84.  
  85. { create a minimal new alias from a target fullpath (optional zone and server name) and return alias record handle  }
  86. FUNCTION NewAliasMinimalFromFullPath(fullPathLength: INTEGER;
  87.                                      fullPath: Ptr;
  88.                                      zoneName: Str32;
  89.                                      serverName: Str31;
  90.                                      VAR alias: AliasHandle): OSErr;
  91.  INLINE $7009,$A823;
  92.  
  93. { given an alias handle and fromFile, resolve the alias, update the alias record and return aliased filename and wasChanged flag. }
  94. FUNCTION ResolveAlias(fromFile: FSSpecPtr;
  95.                       alias: AliasHandle;
  96.                       VAR target: FSSpec;
  97.                       VAR wasChanged: BOOLEAN): OSErr;
  98.  INLINE $7003,$A823;
  99.  
  100. { given an alias handle and an index specifying requested alias information type, return the information from alias record as a string. }
  101. FUNCTION GetAliasInfo(alias: AliasHandle;
  102.                       index: AliasInfoType;
  103.                       VAR theString: Str63): OSErr;
  104.  INLINE $7007,$A823;
  105.  
  106. {  given a file spec, return target file spec if input file spec is an alias.
  107.  It resolves the entire alias chain or one step of the chain.  It returns
  108.  info about whether the target is a folder or file; and whether the input
  109.  file spec was an alias or not.  }
  110. FUNCTION ResolveAliasFile(VAR theSpec: FSSpec;
  111.                           resolveAliasChains: BOOLEAN;
  112.                           VAR targetIsFolder: BOOLEAN;
  113.                           VAR wasAliased: BOOLEAN): OSErr;
  114.  INLINE $700C,$A823;
  115.  
  116. {   Low Level Routines 
  117. given an alias handle and fromFile, match the alias and return aliased filename(s) and needsUpdate flag }
  118. FUNCTION MatchAlias(fromFile: FSSpecPtr;
  119.                     rulesMask: LONGINT;
  120.                     alias: AliasHandle;
  121.                     VAR aliasCount: INTEGER;
  122.                     aliasList: FSSpecArrayPtr;
  123.                     VAR needsUpdate: BOOLEAN;
  124.                     aliasFilter: AliasFilterProcPtr;
  125.                     yourDataPtr: UNIV Ptr): OSErr;
  126.  INLINE $7005,$A823;
  127.  
  128. { given a fromFile-target pair and an alias handle, update the lias record pointed to by alias handle to represent target as the new alias. }
  129. FUNCTION UpdateAlias(fromFile: FSSpecPtr;
  130.                      target: FSSpec;
  131.                      alias: AliasHandle;
  132.                      VAR wasChanged: BOOLEAN): OSErr;
  133.  INLINE $7006,$A823;
  134.  
  135.  
  136. {$ENDC} { UsingAliases }
  137.  
  138. {$IFC NOT UsingIncludes}
  139.  END.
  140. {$ENDC}
  141.  
  142.